package com.kedi.welfarecenter.read.dao.mapper;


import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;
/**
* @Description:    长者就业sql
* @Author:         ytw
* @CreateDate:     2019/7/12 9:44
* @UpdateRemark:   修改内容
* @Version:        1.0
*/
@Mapper
public interface JobMapper {
	
	/**
	 * 				查询用户对应的工作信息
	 * @return		findList
	 */
    @Select("select job_id,price,job.p_user_id,positon,salaryrange,paymethod,lon_lat,workAddress,name " +
            "from user left join job on user.p_user_id=job.p_user_id where job.job_id is not null")
    List<Map> findList();

	/**
	 * 				根据id查询工作者信息
	 * @param		id
	 * @return		findList
	 */
    @Select("select phone.code,job.p_user_id as fbpuserid,job_id,price,positon,salaryrange,paymethod,hiring_num,education,experience,workAddress,describle,lon_lat \n" +
			"            from user left join job on user.p_user_id=job.p_user_id left join user_phone on user_phone.p_phone_id=user.p_user_id left join phone on phone.p_phone_id=user_phone.p_phone_id\n" +
			" where  job_id=1")
    Map<String,Object> findDetail(@Param("id") Integer id );

    /**
    * 方法实现说明  根据用户id查找电话
    * @author      ytw
    *@param
    * @return
    * @exception
    * @date        2019/8/2 10:39
    */
	@Select("select phone.code from phone left join user_phone on user_phone.p_phone_id=phone.p_phone_id left join deliver on user_phone.p_user_id=deliver.p_user_id where user_phone.p_user_id=#{p_user_id}")
	Map<String,Object> findPhone(@Param("p_user_id")Integer p_user_id);

	/**
	* 方法实现说明  根据用户id和就业id查找是否长者就业申请id
	* @author      ytw
	*@param
	* @return
	* @exception
	* @date        2019/8/2 11:03
	*/
	@Select("select deliver_id from deliver where job_id=#{job_id} and p_user_id=#{p_user_id}")
	Map<String,Object> finddeliverid(Map map);
}
